/**
 * 👨‍💻 伟谭
 * 📅 2017/11/27
 */



#import "TWConvenienceServiceDetailsOfAlbumCollectionViewCell.h"

@interface TWConvenienceServiceDetailsOfAlbumCollectionViewCellOfCollectionViewOfcellItem : UICollectionViewCell

@property(nonatomic,readwrite) UIImageView *imageViewContent;

@end

@implementation TWConvenienceServiceDetailsOfAlbumCollectionViewCellOfCollectionViewOfcellItem

-(instancetype)initWithFrame:(CGRect)frame {
    
    if(self) {
    
        self = [super initWithFrame:frame];
        
        UIImageView *imageViewContent = [UIImageView new];
        imageViewContent.image = [UIImage imageWithColor:randomColor size:CGSizeMake(2.0f, 2.0f)];
        [self.contentView addSubview:imageViewContent];
        
        [imageViewContent mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.offset(0.0f);
        }];
        
    }
    return self;
    
}

@end


@interface TWConvenienceServiceDetailsOfAlbumCollectionViewCell() <UICollectionViewDelegateFlowLayout,UICollectionViewDataSource,UICollectionViewDelegate>


@property (nonatomic,strong) UICollectionView *mainCollectionView;

@end

static NSString *const idinter = @"twSSt";

@implementation TWConvenienceServiceDetailsOfAlbumCollectionViewCell

#pragma mark - Class method

#pragma mark - Life cycle

#pragma mark - Override

-(instancetype)initWithFrame:(CGRect)frame {
    if(self){
    
        self = [super initWithFrame:frame];
    
        UICollectionViewFlowLayout * collectionViewFlowLayout = [UICollectionViewFlowLayout new];
        collectionViewFlowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
        
        UICollectionView *mainCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:collectionViewFlowLayout];
        mainCollectionView.showsVerticalScrollIndicator = NO;
        mainCollectionView.showsHorizontalScrollIndicator = NO;
        mainCollectionView.backgroundColor = [UIColor whiteColor];
        mainCollectionView.delegate = self;
        mainCollectionView.dataSource = self;
        mainCollectionView.scrollsToTop = NO;
        [self addSubview:mainCollectionView];
        _mainCollectionView = mainCollectionView;
        
        [mainCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.offset(0.0f);
        }];
        
        
        
        [mainCollectionView registerClass:[TWConvenienceServiceDetailsOfAlbumCollectionViewCellOfCollectionViewOfcellItem class] forCellWithReuseIdentifier:idinter];
        
    }
    return self;
    
    
}

#pragma mark - Event response

#pragma mark - Protocol

#pragma mark <<#XXXDelegate#>>

-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {

    return 1;
}

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {

    return 8;
}

-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
    // 8-3.0f
    return UIEdgeInsetsMake(5.0f, 6.0f, 8.0f, 6.0);

}

-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {

    return 6.0f;
}

-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {

    return 0.0f;
}

-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {

    CGFloat heightAndWidth = collectionView.hj_height - 2 * 8.0f;
    return CGSizeMake(heightAndWidth, heightAndWidth);
}

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {

    TWConvenienceServiceDetailsOfAlbumCollectionViewCellOfCollectionViewOfcellItem *cell = [collectionView dequeueReusableCellWithReuseIdentifier:idinter forIndexPath:indexPath];
    return cell;
}


#pragma mark - Public method

#pragma mark - Private method

#pragma mark - Getter & Setter

@end
